#ifndef VS1053_SPI_DRIVER_H
#define VS1053_SPI_DRIVER_H

#include "vs1053_defines.h"
#include <stdint.h>

/****************************************************************************
* Purpose:	Writes 16bit value to vs register
* Input:	vs register to be written to (enumeration), highbyte, and lowbyte
* Output:   No Output
****************************************************************************/
void vsWriteRegister(enum VS_REGISTER reg, uint8_t highB, uint8_t lowB);

/****************************************************************************
* Purpose:	Reads 16bit value from a vs register
* Input:	vs register to be read (enumeration)
* Output:   Returns the 16bit value in the register
****************************************************************************/
uint16_t vsReadRegister(enum VS_REGISTER reg);

/****************************************************************************
* Purpose:	Preforms a soft reset of the VS1053b
* Input:	No Input
* Output:   No Output
****************************************************************************/
void vsSoftReset(void);

/****************************************************************************
* Purpose:	Performs a hard reset of the VS1053b
* Input:	No Input
* Output:   No Output
****************************************************************************/
void vsHardReset(void);

/****************************************************************************
* Purpose:	Performs basic initialization of th VS1053b
* Input:	No Input
* Output:   No Output
****************************************************************************/
void vsInit(void);

/****************************************************************************
* Purpose:	Performs basic configuration of VS1053b.
* Input:	No Input
* Output:   No Output
****************************************************************************/
void vsConfigureDevice(void);

/****************************************************************************
* Purpose:	Sets the SPI Clock speed that avr communicates to vs with
* Input:	The spi periphial clock divisor value
* Output:   No Output
****************************************************************************/
void vsSetCTRL(uint8_t clkDiv);

/****************************************************************************
* Purpose:	Sets the volume of media playback on the VS1053
* Input:	Volume level between VOL_MIN and VOL_MAX
* Output:   No Output
****************************************************************************/
void vsSetVol(uint8_t volume);

/****************************************************************************
* Purpose:	Writes a control byte to vs1053
* Input:	Byte to be written
* Output:   No Output
****************************************************************************/
void vsWrite(uint8_t data);

/****************************************************************************
* Purpose:	Writes a byte of data to vs1053 to be decoded
* Input:	Pointer to uint8_t containing next byte to be decoded
* Output:   No Output
****************************************************************************/
void vsWriteData(uint8_t *data);

/****************************************************************************
* Purpose:	Used to write a byte to VS1053 without modifying CS or DCS
* Input:	Byte to be written
* Output:   No Output
****************************************************************************/
void vsWriteMultiByte(uint8_t data);

/****************************************************************************
* Purpose:	Attempts to stop song playback of vs1053 correctly.
* Input:	No Input
* Output:	Returns 0 on failure to stop playback normally, 1 on success
****************************************************************************/
uint8_t vsStopPlayBack();
#endif /* VS1053_SPI_DRIVER_H */




